<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hammerspoon docs: SendToOmniFocus</title>
    <style type="text/css">
      a { text-decoration: none; }
      a:hover { text-decoration: underline; }
      th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
      td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
      table { width: 100% ; border: 1px solid #0; text-align: left; }
      section > table table td { width: 0; }
    </style>
    <link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
  </head>
  <body>
    <header>
      <h1><a href="./index.html">docs</a> &raquo; SendToOmniFocus</h1>
      <p>Handles "send current item to OmniFocus" for multiple applications</p>
<p>The following applications are supported: out of the box: Outlook, Evernote, Mail, Chrome and any Chrome-based apps (such as SSBs created by <a href="https://github.com/dmarmor/epichrome">Epichrome</a>)</p>
<p>Download: <a href="https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SendToOmniFocus.spoon.zip">https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SendToOmniFocus.spoon.zip</a></p>

      </header>
      <h3>API Overview</h3>
      <ul>
        <li>Variables - Configurable values</li>
          <ul>
            <li><a href="#actions">actions</a></li>
            <li><a href="#logger">logger</a></li>
            <li><a href="#notifications">notifications</a></li>
            <li><a href="#quickentrydialog">quickentrydialog</a></li>
          </ul>
        <li>Methods - API calls which can only be made on an object returned by a constructor</li>
          <ul>
            <li><a href="#bindHotkeys">bindHotkeys</a></li>
            <li><a href="#registerApplication">registerApplication</a></li>
            <li><a href="#sendCurrentItem">sendCurrentItem</a></li>
          </ul>
      </ul>
      <h3>API Documentation</h3>
        <h4 class="documentation-section">Variables</h4>
          <section id="actions">
            <a name="//apple_ref/cpp/Variable/actions" class="dashAnchor"></a>
            <h5><a href="#actions">actions</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.actions</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Table containing application handlers for sending the current item to OmniFocus.
Each entry's key is the application name, and its value is another table with the following keys:</p>
<ul>
<li><code>itemname</code> - how to name the current item in the context of the application. Purely for cosmetic purposes in the notifications (e.g. in Mail, the notification says "filing message" instead of "filing item". Defaults to "item".</li>
<li>One of the following, invoked to do the actual filing:<ul>
<li><code>as_scriptfile</code> - path of a file containing AppleScript code. It will be executed using the <code>osascript</code> command. If <code>quickentrydialog</code> is set to <code>false</code>, the string <code>nodialog</code> will be passed as argument to the script.</li>
<li><code>as_script</code> - string containing AppleScript code. There is no way to pass an argument to the script via this method.</li>
<li><code>fn</code> - a function. It will be passed a boolean indicating the value of <code>quickentrydialog</code>.</li>
<li><code>apptype</code> - a predefined "application type" to trigger different behavior for application families. The only valid value at the moment is "chromeapp", which can be used for any Chrome-based applications, including Google Chrome itself and, for example, any site-specific browsers generated using <a href="https://github.com/dmarmor/epichrome">Epichrome</a>.</li>
</ul>
</li>
</ul>
<p>The built-in handlers for Outlook, Evernote, Chrome and Mail are implemented by scripts bundled with the SendToOmniFocus spoon.
New handlers can be registered using <code>SendToOmniFocus:registerApplication()</code></p>
<p>Default value:</p>

<pre><code>  {
     ["Microsoft Outlook"] = {
        as_scriptfile = _resource_path("scripts/outlook-to-omnifocus.applescript"),
        itemname = "message"
     },
     Evernote = {
        as_scriptfile = _resource_path("scripts/evernote-to-omnifocus.applescript"),
        itemname = "note"
     },
     ["Google Chrome"] = {
        apptype = "chromeapp",
        itemname = "tab"
     },
     Mail = {
        as_scriptfile = _resource_path("scripts/mail-to-omnifocus.applescript"),
        itemname = "message"
     }
  }</code></pre>
</td>
              </tr>
            </table>
          </section>
          <section id="logger">
            <a name="//apple_ref/cpp/Variable/logger" class="dashAnchor"></a>
            <h5><a href="#logger">logger</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.logger</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.</p>
</td>
              </tr>
            </table>
          </section>
          <section id="notifications">
            <a name="//apple_ref/cpp/Variable/notifications" class="dashAnchor"></a>
            <h5><a href="#notifications">notifications</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.notifications</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean to control Hammerspoon-generated notifications when filing items (doest not control AppleScript notifications, if any, generated from within the scripts). Defaults to <code>true</code>.</p>
</td>
              </tr>
            </table>
          </section>
          <section id="quickentrydialog">
            <a name="//apple_ref/cpp/Variable/quickentrydialog" class="dashAnchor"></a>
            <h5><a href="#quickentrydialog">quickentrydialog</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.quickentrydialog</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Whether to display the new tasks in the OmniFocus quick-entry dialog before adding them. Defaults to <code>true</code> (set to <code>false</code> to send directly to the Inbox, without prompting)</p>
</td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Methods</h4>
          <section id="bindHotkeys">
            <a name="//apple_ref/cpp/Method/bindHotkeys" class="dashAnchor"></a>
            <h5><a href="#bindHotkeys">bindHotkeys</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:bindHotkeys(mapping)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Binds hotkeys for SendToOmniFocus</p>
<p>Parameters:</p>
<ul>
<li>mapping - A table containing hotkey objifier/key details for the following items:<ul>
<li>send_to_omnifocus - file current item to OmniFocus.</li>
</ul>
</li>
</ul>
</td>
              </tr>
            </table>
          </section>
          <section id="registerApplication">
            <a name="//apple_ref/cpp/Method/registerApplication" class="dashAnchor"></a>
            <h5><a href="#registerApplication">registerApplication</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:registerApplication(app, handlerSpec)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Register a new application handler</p>
<p>Parameters:</p>
<ul>
<li>app - application name</li>
<li>handlerSpec - a handler definition in the format of <code>SendToOmniFocus.actions</code>, or <code>nil</code> to unregister the application.</li>
</ul>
</td>
              </tr>
            </table>
          </section>
          <section id="sendCurrentItem">
            <a name="//apple_ref/cpp/Method/sendCurrentItem" class="dashAnchor"></a>
            <h5><a href="#sendCurrentItem">sendCurrentItem</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:sendCurrentItem</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Send current item in current application to OmniFocus by triggering the appropriate handler.</p>
<p>Paramters:</p>
<ul>
<li>None</li>
</ul>
<p>Returns:</p>
<ul>
<li>The SendToOmniFocus object</li>
</ul>
</td>
              </tr>
            </table>
          </section>
  </body>
</html>